#pragma once
#include <string>
using namespace std;
#include "Particle.h"
#include <list>
using namespace std;
#include "SGD Wrappers\CSGD_Direct3D.h"
#include "SGD Wrappers\CSGD_TextureManager.h"
#include "SGD Wrappers\tinyxml.h"
#include <Windows.h>
#include <d3d9.h>
#include "Particle.h"
#include <time.h>
#include "SGD Wrappers\SGD_Math.h"
using namespace std;

class CParticleEmitter
{
private:
	int tempImg;
	RECT m_rSpawnRect;
	float m_fHeight;
	float m_fWidth;
	int m_nPosX;
	int m_nPosY;
	D3DRENDERSTATETYPE m_eSourceBlend;
	D3DRENDERSTATETYPE m_eDestBlend;
	DWORD m_ePrevSourceBlend;
	DWORD m_ePrevDestBlend;
	int m_nMaxParticle;
	float m_fLifeMin;
	float m_fLifeMax;
	int m_nImageID;
	std::list<CParticle*> m_lLive;
	std::list<CParticle*> m_lDead;
	float m_fSpawnRate;
	float m_fScaleXStart;
	float m_fScaleXEnd;
	float m_fScaleTimer;
	float m_fScaleYStart;
	float m_fScaleYEnd;
	float m_fRotationStart;
	float m_fRotationEnd;
	float m_fRotationTimer;
	int m_nColorRStart;
	int m_nColorGStart;
	int m_nColorBStart;
	int m_nColorAStart;
	int m_nColorREnd;
	int m_nColorGEnd;
	int m_nColorBEnd;
	int m_nColorAEnd;
	float m_fColorTimer;
	bool m_bLooping;
	int m_fVelocityYStart;
	int m_fVelocityYEnd;
	int m_fVelocityXStart;
	int m_fVelocityXEnd;
	int m_fVelocityXMin;
	int m_fVelocityXMax;
	int m_fVelocityYMin;
	int m_fVelocityYMax;
	int m_fVelocityTimer;
	//std::string m_strType;
	CSGD_Direct3D* m_pD3D;
	CSGD_TextureManager* m_pTM;
	CParticle* temppart;
public:
	CParticleEmitter(void);
	void Update(float fElapsedTime);
	void Render();
	bool Load(const char* strName);
	void SpawnParticles(char const*const thestring);
	~CParticleEmitter(void);
};